package com.lightsaber.trade.core.entity.account;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Index;

import com.lightsaber.trade.core.entity.BaseEntity;

@Entity
@Table(name = "ACCT_ORG")
public class Organization extends BaseEntity {

    @Index(name = "acct_org_code")
    @Column(name = "org_code", unique = true, nullable = false, length = 20)
    private String orgCode;

    @Column(name = "company", nullable = false, length = 20)
    private String company;

    @Column(name = "department", nullable = false, length = 20)
    private String department;

    @OneToMany(mappedBy = "organization", cascade = CascadeType.REMOVE, fetch = FetchType.LAZY)
    private List<User> userList;

    public String getOrgCode() {
        return orgCode;
    }

    public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }

    public String getCompany() {
        return company;
    }

    public void setCompany(String company) {
        this.company = company;
    }

    public String getDepartment() {
        return department;
    }

    public void setDepartment(String department) {
        this.department = department;
    }

    public List<User> getUserList() {
        return userList;
    }

    public void setUserList(List<User> userList) {
        this.userList = userList;
    }

}
